package com.ruoyi.common.enums;


public enum ServiceResponseCodeEnum {
    E010230001("E010230001", "不支持的业务类型"),
    E010230002("E010230002", "未知的商户"),
    E010230003("E010230003", "超出额度"),
    E010230004("E010230004", "非服务开放时间"),
    E010230005("E010230005", "查无此请求"),
    E010230006("E010230006", "请款失败"),
    E010230007("E010230007", "重复请求"),
    E010230008("E010230008", "商户额度信息不存在"),
    E010230009("E010230009", "商户状态异常，请联系银行业务"),
    E010230010("E010230010", "超出受理时间范围"),
    E010230011("E010230011", "超过日累计限额"),
    E010230012("E010230012", "请求过于频繁，请稍后再试"),
    E010230013("E010230013", "金额超过单笔限额"),
    E010230014("E010230014", "金额超过银行卡代付限额"),
    E010230015("E010230015", "金额超过商户可用代付限额"),
    E010230016("E010230016", "请求服务出现异常，请稍后再试"),
    E010230017("E010230017", "文件尚未生成，请稍后再试"),
    E010230018("E010230018", "请稍后再试"),
    E010230019("E010230019", "参数配置错误");

    private ServiceResponseCodeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public static ServiceResponseCodeEnum getByCode(String code) {
        if(code == null) {
            return null;
        }
        code = code.trim();
        if(code.equals("")) {
            return null;
        }
        for(ServiceResponseCodeEnum item : ServiceResponseCodeEnum.values()) {
            if(item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }
    /**
     * 判断是否相等
     *
     * @param code
     * @return
     */
    public boolean equalEnum(String code) {
        if (code == null) {
            return false;
        }
        return this.code.equals(code);
    }
}
